#!/bin/bash

rootfs_path=busybox-rootfs

rm -rf ${rootfs_path}.ext4

dd if=/dev/zero of=${rootfs_path}.ext4 bs=1M count=512

mkfs.ext4 ${rootfs_path}.ext4

if [ ! -d mnt-${rootfs_path} ];then
    mkdir mnt-${rootfs_path}
fi

sudo mount -o loop ${rootfs_path}.ext4 mnt-${rootfs_path}
sudo cp -rfd busybox-1.36.0/_install/* mnt-${rootfs_path}/
sudo cp -rfd extra_busybox/* mnt-${rootfs_path}/
sudo umount mnt-${rootfs_path}